import {
    observable,
    action
} from "mobx-miniprogram";
export const inspectionHistroyIndexFilterStore = observable({
    activedTab: 'assetType',
    listApi:null,
    // 单元目录 
    directory: [],
    // 巡检结束时间
    inspectionEndTime: '',
    // 巡检开始时间
    inspectionStartTime: '',
    // 巡检人
    inspectUserIdList: [],
    // 巡检结果（1正常 2异常）
    result: [],
    // 资产类型
    assetsType: [],
    //    使用科室
    useDept: [],
     setActivedTab: action(function (val) {
         this.activedTab = val
     }),
     setListApi: action(function (val) {
         this.listApi = val
     }),
    // 设置资产类型
    setAssetsType: action(function (val) {
        this.assetsType = val.map(item => item.value)
    }),
    // 设置单元目录
    setDirectory: action(function (val) {
        this.directory = val.map(item => item.value)
    }),
    setUseDept: action(function (val) {
        this.useDept = val.map(item => item.value)
    }),
    // 设置巡检结果
    setResult: action(function (e) {
        this.result = e.detail.value
    }),
    //设置巡检时间
    setCompleteDate: action(function (e) {
        this.inspectionStartTime = e.detail.value[0]
        this.inspectionEndTime = e.detail.value[1]

    }),

    // 设置巡检人
    setInspectUserIdList: action(function (list) {
        this.setInspectUserIdList = list.map(item => item.userId)
    }),

    // 重置
    inspectionHistroyIndexFilterStoreReset: action(function () {
        this.directory = ''
        this.inspectionEndTime = ''
        this.inspectionStartTime = ''
        this.inspectUserIdList = []
        this.keyword = ''
        this.result = ''
        this.assetsType = []
        this.useDept = ''
    })


});